WorkspaceLayout's allocation reads child.boundingBox four times for each
window on every frame of an overview transition. The getter returns a
fresh copy of the cached box on every access, so this is four throwaway
objects per window per frame feeding the garbage collector.
Read the box into a local once and use that. The values are identical;
only the per-frame allocations go away.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4250>
(cherry picked from commit
d4b5bc781535104475fba490fccfb0dd7934c96f)
let workspaceBoxWidth, workspaceBoxHeight;
if (windowInfo.metaWindow.showing_on_its_workspace()) {
- workspaceBoxX = (child.boundingBox.x - workareaX) * allocationScale;
- workspaceBoxY = (child.boundingBox.y - workareaY) * allocationScale;
- workspaceBoxWidth = child.boundingBox.width * allocationScale;
- workspaceBoxHeight = child.boundingBox.height * allocationScale;
+ const {boundingBox} = child;
+ workspaceBoxX = (boundingBox.x - workareaX) * allocationScale;
+ workspaceBoxY = (boundingBox.y - workareaY) * allocationScale;
+ workspaceBoxWidth = boundingBox.width * allocationScale;
+ workspaceBoxHeight = boundingBox.height * allocationScale;
} else {
workspaceBoxX = workareaX * allocationScale;
workspaceBoxY = workareaY * allocationScale;